#define FAST_STACK

#ifndef DEFINES_H
#define DEFINES_H

/////////////////// DEFINE REGISTERS ///////////////////

#define REG(file, num, sub, type)\
							#file#num"."#sub":"#type
#define REG_LEAP(file, num, sub, leap, type)\
							#file#num"."#sub"<"#leap">:"#type
#define REG_COMPLETE(file, num, sub, vstride, width, hstride, type)\
							#file#num"."#sub"<"#vstride";"#width","#hstride">:"#type
#define REG_INDEX(type)		"r[a0.0]:"#type

// negtive registers

#define NEG_REG(file, num, sub, type)\
							"-"#file#num"."#sub":"#type
#define NEG_REG_LEAP(file, num, sub, leap, type)\
							"-"#file#num"."#sub"<"#leap">:"#type
#define NEG_REG_COMPLETE(file, num, sub, vstride, width, hstride, type)\
							"-"#file#num"."#sub"<"#vstride";"#width","#hstride">:"#type
#define NEG_REG_INDEX(type)	"-r[a0.0]:"#type

/////////////////// CONSTANTS ///////////////////

#define BASE_REG_OFFSET		10
#define ADDR_PER_REG		32
#define BASE_ADDR_OFFSET	(BASE_REG_OFFSET*ADDR_PER_REG)

#define ADDR_PER_DWORD		4
#define INST_LEN			2

#define Y_SURFACE			0
#define UV_SURFACE			1
#define STACK_SURFACE		2

/////////////////// STRING NAMES ///////////////////

// number constants

#define ZERO				"0:d"
#define ONE					"1:d"
#define NEG_ONE				"-1:d"

// compare types

#define EQUAL				".e"
#define NOT_EQUAL			".ne"
#define LESS				".l"
#define LESS_EQUAL			".le"
#define GREATER				".g"
#define GREATER_EQUAL		".ge"

// registers for special use, especially inner fuction parameters

#define REG_READ			REG(r, 0, 00, d)

// r0.04 r0.08 r0.12 are reserved

#define REG_ESP				REG(r, 0, 16, d)

#ifdef	FAST_STACK

#define FAST_STACK_BOTTOM	"0X0FFC:uw"
#define REG_ADDR_CACHE		REG(r, 0, 20, d)

#endif

#define REG_WRITE			REG(r, 1, 00, d)

// r1.04 r1.08 r1.12 are reserved

#define REG_LINKAGE_0		REG(r, 1, 16, d)
#define REG_LINKAGE_1		REG(r, 1, 20, d)
#define REG_LINKAGE_1N		NEG_REG(r, 1, 20, d)

#define REG_POS_X			REG(r, 1, 24, uw)
#define REG_POS_Y			REG(r, 1, 26, uw)
#define REG_COLOR_Y_UW		REG(r, 1, 28, uw)
#define REG_COLOR_UV_UW		REG(r, 1, 30, uw)

#define REG_DES				REG(r, 2, 00, d)
#define REG_DES1			REG(r, 3, 00, d)
#define REG_SRC0			REG(r, 2, 00, d)
#define REG_SRC1			REG(r, 3, 00, d)

#define REG_DES_F			REG(r, 2, 00, f)
#define REG_SRC0_F			REG(r, 2, 00, f)
#define REG_SRC1_F			REG(r, 3, 00, f)

#define REG_RET				REG(r, 3, 00, d)

// message registers

#define REG_M_RW_POS		REG(m, 0, 08, ud)
#define REG_M_WRITE			REG(m, 1, 00, d)
#define REG_M_WRITE1		REG(m, 1, 04, d)
#define REG_M_WRITE2		REG(m, 1, 08, d)
#define REG_M_WRITE3		REG(m, 1, 12, d)

#define REG_M_HEADER		REG(m, 0, 00, ud)
#define REG_M_BODY			REG(m, 1, 00, ud)

#define REG_M_POSX			REG(m, 0, 00, ud)
#define REG_M_POSY			REG(m, 0, 04, ud)
#define REG_M_BLOCKSIZE		REG(m, 0, 08, ud)
#define REG_M_COLOR_UW		REG(m, 1, 00, uw)

// special registers

#define REG_IP				"ip:d"

#define REG_COND			"f0.0"

#define REG_ADDR			"a0.0:uw"

#include "usr_color.h"

#endif							// end of DEFINES_H
